Previous Book Contents Book Index Next

Inside Macintosh: Open Transport /
Chapter 3 - Endpoints / Endpoints Reference
Constants and Data Types


The TCall Structure

You use the TCall structure to specify the options and data associated with establishing a connection. You pass a pointer to this structure as a parameter to the OTConnect function (page 3-121), the OTRcvConnect function (page 3-123), the OTListen function (page 3-125), and the OTAccept function (page 3-127).

The TCall structure is defined by the TCall data type.

struct TCall
   {
      TNetbuf     addr;
      TNetbuf     opt;
      TNetbuf     udata;
      OTSequence  sequence;
   };
   
   typedef struct TCall TCall;
Field Description
addr
A TNetbuf structure that specifies the location and size of a buffer containing an address. If you are using the TCall structure to send information, you must allocate a buffer and initialize it to contain the address, you must set the addr.buf field to point to the buffer, and you must set the addr.len field to the size of the address. If you are using the TCall structure to receive information, you must allocate a buffer into which the function can place the address when it returns, you must set the addr.buf field to point to this buffer, and you must set the addr.maxlen field to the maximum size of the address.
In the sndCall parameter to the OTConnect function, you must use this field to specify information about the address of the remote peer.
In the rcvCall parameter to the OTConnect function, on return, this field contains information about the address to which you are actually connected.
In the call parameter to the OTRcvConnect function, on return, this field contains information about the address to which you are actually connected.
In the call parameter to the OTListen function, on return, this field contains information about the address of the peer that requested the connection. The function returns the address in a format that you can use in future calls to the OTConnect function (page 3-121), the OTSndDisconnect function (page 3-149), the OTSndOrderlyDisconnect function (page 3-153), or the OTAccept function (page 3-127).
In the call parameter to the OTAccept function, you can use this field to specify information about the address of the peer that requested the connection. If you do not want to specify a value, set the addr.len field to 0.
In the call parameter to the OTSndDisconnect function, this field is reserved.
opt
A TNetbuf structure that specifies the location and size of a buffer containing option information. If you are using the TCall structure to send information, you must allocate a buffer and initialize it to contain the option information, you must set the opt.buf field to point to the buffer, and you must set the opt.len field to the size of the option data. Set the opt.len field to 0 if you don't want to specify any options. If you are using the TCall structure to receive information, you must allocate a buffer into which the function can place option data when it returns, you must set the opt.buf field to point to this buffer, and you must set the opt.maxlen field to the maximum size of the option information.
In the sndCall parameter to the OTConnect function, you can use this field to specify the options you want to negotiate.
In the rcvCall parameter to the OTConnect function, on return, this field specifies the options that have been negotiated for this connection.
In the call parameter to the OTRcvConnect function, on return, this field specifies the options that have been negotiated for this connection.
In the call parameter to the OTListen function, on return, this field specifies the options that the peer has requested for this connection.
In the call parameter to the OTAccept function, you can use this field to specify the options that you want to use for the connection. Specifying 0 for the opt.len field means that you accept the connection unconditionally.
In the call parameter to the OTSndDisconnect function, this field is reserved.
udata
A TNetbuf structure that specifies the location and size of a buffer containing data associated with a connection or disconnection request. Not all endpoints support the sending of data while establishing or tearing down a connection. Examine the connect or discon field of the TEndpointInfo structure for the endpoint to determine if the endpoint supports the sending of data and to find out the maximum size of the data you can send.
If you are using the TCall structure to send data, you must allocate a buffer and initialize it to contain the data, you must set the udata.buf field to point to the buffer, and you must set the udata.len field to the size of the data. If you are using the TCall structure to receive information, you must allocate a buffer into which the function can place the data when it returns, you must set the udata.buf field to point to this buffer, and you must set the udata.maxlen field to the maximum size of the data.
In the sndCall parameter to the OTConnect function, you can use this field to specify the data associated with the connection request.
In the rcvCall parameter to the OTConnect function, on return, this field specifies data that has been sent by the peer accepting the connection.
In the call parameter to the OTListen function, on return, this field specifies data that has been sent by the peer accepting the connection.
In the call parameter to the OTAccept function, you can use this field to specify data you want to send back to the peer that requested the connection.
In the call parameter to the OTSndDisconnect function, this field specifies the location and size of any data associated with the disconnection request.
sequence
A long that is used by the OTListen and OTAccept functions to specify the connection ID.
In the call parameter to the OTListen function, on return, this field contains the connection ID of the incoming request.
In the call parameter to the OTAccept function, you must use this field to specify the connection ID of the connection request that you are accepting. This must be the same value that was passed to you by the OTListen function when you received the connection request.
In the call parameter to the OTSndDisconnect function, this field specifies the same connection ID as was returned by the OTListen function when the connection request was received. You must specify a value if you are calling the OTSndDisconnect function to reject a connection request. This field is only meaningful if the endpoint is in the T_INCON state.

Previous Book Contents Book Index Next

© Apple Computer, Inc.
15 AUG 1996